package com.ibeeking.gmc.global.api.feign;

import com.ibeeking.found.common.entity.DatabaseTemplateDTO;
import com.ibeeking.found.common.entity.DatasourceConfigDTO;
import com.ibeeking.found.common.entity.IndustryFrontendDTO;
import com.ibeeking.gmc.global.api.feign.fallback.GlobalDatasourceFeignFallbackFactory;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * @Author ibeeking
 */
@FeignClient(name = "gmc-global-g-server", contextId = "globalDatasourceFeignClient", path = "/g", fallbackFactory = GlobalDatasourceFeignFallbackFactory.class, decode404 = true)
public interface GlobalDatasourceFeignClient {

    /**
     * 查询租户数据源
     * @param tenantId
     * @return
     */
    @PostMapping(value = "/datasource/feign/v1/queryTenantDatasource/{tenantId}")
    ResponseResult<DatasourceConfigDTO> queryTenantDatasource(@PathVariable("tenantId") Integer tenantId);
    /**
     * 查询租户数据源
     * @param industry
     * @param frontend
     * @return
     */
    @PostMapping(value = "/datasource/feign/v1/queryIndustryFrontend/{industry}/{frontend}")
    ResponseResult<List<IndustryFrontendDTO>> quertIndustryFrontend(@PathVariable("industry") String industry, @PathVariable("frontend") String frontend);

    /**
     * 查询模板库
     * @return
     */
    @PostMapping(value = "/datasource/feign/v1/listTemplateByIndustry/{industry}")
    ResponseResult<List<DatabaseTemplateDTO>> listTemplateByIndustry(@PathVariable("industry") String industry);

}
